# -*- coding:utf-8 -*-
from data_struct.single_link_list import ListLink

##从头到尾打印链表
"""
输入一个链表，按链表值从尾到头的顺序返回一个ArrayList
"""


class Solution:
    # 返回从尾部到头部的列表值序列，例如[1,2,3]
    def printListFromTailToHead(self, listNode):
        if listNode is None: return []
        return self.printListFromTailToHead(listNode.next) + [listNode.val]


if __name__ == '__main__':
    pp = ListLink([67, 0, 24, 58]).get_heap()
    print(Solution().printListFromTailToHead(pp))
